package sample;

import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.layout.AnchorPane;
import javafx.scene.shape.Rectangle;

import java.io.File;

/**
 * 组件创建类
 * @author 司啸飞
 * @create 2021-05-18 7:40
 */
public class Component {

    /**
     * 设置头像圆角
     * @return
     */
    public static void setFaceRadius(ImageView face) {
        // 获取一个矩形，圆角调到最大
        Rectangle rec = new Rectangle(120, 120);
        rec.setArcWidth(300);
        rec.setArcHeight(300);
        face.setClip(rec);
        // 添加头像到窗口，并设置成圆形
        File file1 = new File(".\\image\\face.jpg");
        Image image1 = new Image(file1.toURI().toString());
        face.setImage(image1);
    }

    /**
     * 设置查询窗口风格
     */
    public static void setQueryWindowStyle(AnchorPane queryWindowName){
        // 获取一个矩形，圆角调到最大
        Rectangle rec = new Rectangle(255, 164);
        rec.setArcWidth(30);
        rec.setArcHeight(30);
        queryWindowName.setClip(rec);

    }

}


